import Vue from 'vue'
import Axios from 'axios';

/*const httpAjax = {
  getAreaList(areaTypeCode){
    //MAP_CG
    this.$axios.post(this.DotCtrl+"/mapDictionaryRelation/getRelationInfoList",{
      "parentMenuCode": areaTypeCode,
    })
      .then(res=>{
        //console.log(res);
        let success = res.data;
        let list = [];
        for( let i=0;i<success.length;i++ ){
          success[i].targetMenuCode = success[i].targetMenuCode.split("_")[1];
          list.push(success[i]);
        }
        return list;
      })
      .catch(err=>{
        //console.log(err);
      })
  }
};

export default httpAjax;*/

export function httpAjax(){
  return {
    getAreaList (areaTypeCode){
      //MAP_CG
      let list = [];
      Vue.prototype.$axios.post(Vue.prototype.DotCtrl+"/mapDictionaryRelation/getRelationInfoList",{
        "parentMenuCode": areaTypeCode,
      })
        .then(res=>{
          //console.log(res);
          let success = res.data;
          for( let i=0;i<success.length;i++ ){
            success[i].targetMenuCode = success[i].targetMenuCode.split("_")[1];
            list.push(success[i]);
          }
          return list;
        })
        .catch(err=>{
          //console.log(err);
        });

    }
  }
 /* function getAreaList (areaTypeCode){
    //MAP_CG
    this.$axios.post(this.DotCtrl+"/mapDictionaryRelation/getRelationInfoList",{
      "parentMenuCode": areaTypeCode,
    })
      .then(res=>{
        //console.log(res);
        let success = res.data;
        let list = [];
        for( let i=0;i<success.length;i++ ){
          success[i].targetMenuCode = success[i].targetMenuCode.split("_")[1];
          list.push(success[i]);
        }
        return list;
      })
      .catch(err=>{
        //console.log(err);
      })
  }*/
}
